/* 
 * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; either version 3 of the License, or 
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 * for more details.
 * 
 * You should have received a copy of the GNU General Public License along 
 * with this program; if not, write to the Free Software Foundation, Inc., 
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#ifndef POSTITEMMODEL_H
#define POSTITEMMODEL_H

#include <QObject>
#include <QAbstractListModel>
#include <QModelIndex>
#include "components/threadptr.h"
#include "components/postid.h"

namespace Wishmaster
{
class Thread;
}

class PostItemModel : public QAbstractListModel
{
public:
	PostItemModel(Wishmaster::ThreadPtr thread, QObject* parent = 0);
	virtual ~PostItemModel();

	int rowCount(const QModelIndex &parent = QModelIndex()) const;
	QVariant data(const QModelIndex &index, int role) const;

	void setThread(Wishmaster::ThreadPtr thread);
	void changed(const Wishmaster::PostId& postId);

	Wishmaster::ThreadPtr getThread();
	static const int PostIdRole = Qt::UserRole + 1;
	static const int PicLinkRole = Qt::UserRole + 2;
	static const int PicRole = Qt::UserRole + 3;
	static const int ThreadRole = Qt::UserRole + 4;
private:
	Wishmaster::ThreadPtr m_thread;
};

#endif

